<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 梁家源
  Date: 2021/6/9
  Time: 23:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>首页三</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layuiminicss/public.css" media="all">
    <style>
        .top-panel {
            border: 1px solid #eceff9;
            border-radius: 5px;
            text-align: center;
        }
        .top-panel > .layui-card-body{
            height: 60px;
        }
        .top-panel-number{
            line-height:60px;
            font-size: 30px;
            border-right:1px solid #eceff9;
        }
        .top-panel-tips{
            line-height:30px;
            font-size: 12px
        }
    </style>
</head>
<body>
<!--<div class="layuimini-container">-->
<div class="layuimini-main">

    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs12 layui-col-md2">

            <div class="layui-card top-panel">
                <div class="layui-card-header">用户总量</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md12 top-panel-number">
                            ${indexs.get("userNumber")}
                        </div>
<%--                        <div class="layui-col-xs3 layui-col-md5 top-panel-tips">--%>
<%--                            比昨天 <a style="color: #1aa094">▲0.12</a><br>--%>
<%--                            比七日 <a style="color: #bd3004">▼0.06</a>--%>
<%--                        </div>--%>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md2">

            <div class="layui-card top-panel">
                <div class="layui-card-header">商品总量</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md12 top-panel-number">
                            ${indexs.get("goodsNumber")}
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md2">

            <div class="layui-card top-panel">
                <div class="layui-card-header">订单总量</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md12 top-panel-number">
                            ${indexs.get("orderNumber")}
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md2">

            <div class="layui-card top-panel">
                <div class="layui-card-header">交易额统计</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md12 top-panel-number">
                           ${indexs.get("transactionNumber")}
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md2">

            <div class="layui-card top-panel">
                <div class="layui-card-header">举报统计</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md12 top-panel-number">
                            ${indexs.get("tipOffNumber")}
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="layui-col-xs12 layui-col-md2">

            <div class="layui-card top-panel">
                <div class="layui-card-header">已下架统计</div>
                <div class="layui-card-body">
                    <div class="layui-row layui-col-space5">
                        <div class="layui-col-xs9 layui-col-md12 top-panel-number">
                            ${indexs.get("offShelfNumber")}
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs12 layui-col-md8">
            <div class="layui-card">
                <div class="layui-card-header">最新7天报表统计</div>
                <div class="layui-card-body">
                    <div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-md4">
            <div class="layui-card">
                <div class="layui-card-header">扇形统计</div>
                <div class="layui-card-body">
                    <div id="echarts-pies" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
                </div>
            </div>
        </div>
    </div>


    <div class="layui-row layui-col-space15">
        <div class="layui-col-xs12 layui-col-md5">
            <div class="layui-card">
                <div class="layui-card-header">交易商品类型统计</div>
                <div class="layui-card-body">
                    <div id="echarts-pies2" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-md7">
            <div class="layui-card">
                <div class="layui-card-header">商品数量最多的10种商品类型</div>
                <div class="layui-card-body">
                    <div id="echarts-dataset" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
                </div>
            </div>
        </div>
    </div>


</div>
<!--</div>-->
<script src="${pageContext.request.contextPath}/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['layer', 'echarts'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            echarts = layui.echarts;

        /**
         * 报表功能
         */
        var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
        var optionRecords = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            legend: {
                data: ['平台用户', '平台商品', '交易次数', '举报商品', '下架商品']
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'category',
                    boundaryGap: false,
                    data: ['${dataBeanList.get(0).date}','${dataBeanList.get(1).date}','${dataBeanList.get(2).date}','${dataBeanList.get(3).date}','${dataBeanList.get(4).date}','${dataBeanList.get(5).date}','${dataBeanList.get(6).date}']
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ],
            series: [
                {
                    name: '平台用户',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {},
                    data:[${dataBeanList.get(0).userNumber}, ${dataBeanList.get(1).userNumber}, ${dataBeanList.get(2).userNumber}, ${dataBeanList.get(3).userNumber}, ${dataBeanList.get(4).userNumber}, ${dataBeanList.get(5).userNumber}, ${dataBeanList.get(6).userNumber}]
                },
                {
                    name: '平台商品',
                    type: 'line',
                    areaStyle: {},
                    data:[${dataBeanList.get(0).goodNumber}, ${dataBeanList.get(1).goodNumber}, ${dataBeanList.get(2).goodNumber}, ${dataBeanList.get(3).goodNumber}, ${dataBeanList.get(4).goodNumber}, ${dataBeanList.get(5).goodNumber}, ${dataBeanList.get(6).goodNumber}]
                },
                {
                    name: '交易次数',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {},
                    data:[${dataBeanList.get(0).orderNumber}, ${dataBeanList.get(1).orderNumber}, ${dataBeanList.get(2).orderNumber}, ${dataBeanList.get(3).orderNumber}, ${dataBeanList.get(4).orderNumber}, ${dataBeanList.get(5).orderNumber}, ${dataBeanList.get(6).orderNumber}]
                },
                {
                    name: '举报商品',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {},
                    data:[${dataBeanList.get(0).tipOffNumber}, ${dataBeanList.get(1).tipOffNumber}, ${dataBeanList.get(2).tipOffNumber}, ${dataBeanList.get(3).tipOffNumber}, ${dataBeanList.get(4).tipOffNumber}, ${dataBeanList.get(5).tipOffNumber}, ${dataBeanList.get(6).tipOffNumber}]
                },
                {
                    name: '下架商品',
                    type: 'line',
                    stack: '总量',
                    // label: {
                    //     normal: {
                    //         show: true,
                    //         position: 'top'
                    //     }
                    // },
                    areaStyle: {},
                    data: [${dataBeanList.get(0).offShelfNumber}, ${dataBeanList.get(1).offShelfNumber}, ${dataBeanList.get(2).offShelfNumber}, ${dataBeanList.get(3).offShelfNumber}, ${dataBeanList.get(4).offShelfNumber}, ${dataBeanList.get(5).offShelfNumber}, ${dataBeanList.get(6).offShelfNumber}]
                },
            ]
        };
        echartsRecords.setOption(optionRecords);


        /**
         * 玫瑰图表
         */
        var echartsPies = echarts.init(document.getElementById('echarts-pies'), 'walden');
        var optionPies = {
            // title: {
            //     text: '指标名称-玫瑰图',
            //     left: 'center'
            // },
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data:['平台用户','平台商品','交易次数','举报商品','下架商品']
            },
            series: [
                {
                    name: '占比',
                    type: 'pie',
                    radius: '55%',
                    center: ['50%', '60%'],
                    roseType: 'radius',
                    data: [
                        {value: ${indexs.get("userNumber")}, name: '平台用户'},
                        {value: ${indexs.get("goodsNumber")}, name: '平台商品'},
                        {value: ${indexs.get("orderNumber")}, name: '交易次数'},
                        {value: ${indexs.get("tipOffNumber")}, name: '举报商品'},
                        {value: ${indexs.get("offShelfNumber")}, name: '下架商品'}
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        echartsPies.setOption(optionPies);


        /**
         * 柱状图
         */
        var echartsDataset = echarts.init(document.getElementById('echarts-dataset'), 'walden');

        var optionDataset = {
            legend: {},
            tooltip: {},
            dataset: {
                dimensions: ['product',
                    <c:forEach var="x" begin="0" end="8" step="1" >
                        '${mostCategoryList.get(x).gcid}',
                    </c:forEach>
                    '${mostCategoryList.get(9).gcid}'],
                source: [
                    {product: '',
                        <c:forEach var="x" begin="0" end="8" step="1">
                            '${mostCategoryList.get(x).gcid}': ${mostCategoryList.get(x).gnumber},
                        </c:forEach>
                        '${mostCategoryList.get(9).gcid}': ${mostCategoryList.get(9).gnumber}}
                ]
            },
            xAxis: {type: 'category'},
            yAxis: {},
            // Declare several bar series, each will be mapped
            // to a column of dataset.source by default.
            series: [
                {type: 'bar'}, {type: 'bar'}, {type: 'bar'}, {type: 'bar'}, {type: 'bar'},
                {type: 'bar'}, {type: 'bar'}, {type: 'bar'}, {type: 'bar'}, {type: 'bar'}
            ]
        };

        echartsDataset.setOption(optionDataset);


        /**
         * 中国地图
         */
        var echartsPies2 = echarts.init(document.getElementById('echarts-pies2'), 'walden');

        var optionPies2 = {
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 'left',
                data:[
                    <c:forEach var="name" items="${transactionCategoryList}">
                        '${name.gcid}',
                    </c:forEach>
                    '${lastOneTransactionCategory.gcid}'
                ]
            },
            series: [
                {
                    name: '占比',
                    type: 'pie',
                    radius: '55%',
                    center: ['50%', '60%'],
                    roseType: 'radius',
                    data: [
                        <c:forEach var="var" items="${transactionCategoryList}">
                            {value: ${var.gnumber}, name: '${var.gcid}'},
                        </c:forEach>
                        {value: ${lastOneTransactionCategory.gnumber}, name: '${lastOneTransactionCategory.gcid}'}
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        echartsPies2.setOption(optionPies2);

        // echarts 窗口缩放自适应
        window.onresize = function () {
            echartsRecords.resize();
        }

    });
</script>
</body>
</html>

